package com.hsyt.pms.security.service.impl;


import com.hsyt.pms.security.dao.AuthorityDao;
import com.hsyt.pms.security.service.AuthorityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: AuthorityServiceImpl
 * @Description: 用户权限相关的接口实现
 * @author 王勇琳
 * @date 2017年7月5日 下午6:37:51
 */
@Service
public class AuthorityServiceImpl implements AuthorityService {
	
	@Autowired
	private AuthorityDao authorityDao;

	@Override
	public List<String> findAuthoritiesByUserId(Long userId) {
		List<String> functionCodes = authorityDao.findFunctionCodesByUserId(userId);
		List<String> authorities = new ArrayList<String>();
		if(functionCodes!=null && functionCodes.size()>0){
			authorities.addAll(functionCodes);
		}
		return authorities;
	}

}
